﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.PermissionManagement;

namespace ERP.MaterialTypes
{
    public class MaterialTypeEntityTypeConfiguration : IEntityTypeConfiguration<MaterialType>
    {
        //MaterialTypeEntityTypeConfiguration
        public void Configure(EntityTypeBuilder<MaterialType> builder)
        {
            builder.ToTable(ERPConsts.DbTablePrefix + nameof(MaterialType), ERPConsts.DbSchema);
            builder.ConfigureByConvention(); //auto configure for the base class props
            builder.Property(x => x.Name).IsRequired().HasMaxLength(128);
            builder.Property(x => x.Description).HasMaxLength(200);
            builder.ConfigureByConvention();
        }
    }
}
